import React, { Component } from 'react'
import { connect } from 'react-redux'
import {add} from "../reducers/textReducer"

export class Text extends Component <any,any>{
  render() {
    return (
      <div>
          <div>公共数据：{this.props.val}</div>
          <div><button onClick={()=>{
              this.props.add(5)
          }}>+</button></div>
      </div>
    )
  }
}

const mapStateToProps = (state:any) => ({
    val:state.textInfo.value
})

const mapDispatchToProps = {
    add
}

export default connect(mapStateToProps, mapDispatchToProps)(Text)